<#import "template.ftl" as layout>
<@layout.registrationLayout displayInfo=social.displayInfo; section>
    <#if section = "title">
        ${msg("loginTitle",(realm.displayName!''))}
    <#elseif section = "header">
        <div class="title">
            ${msg("loginTitleHtml",(realm.displayNameHtml!''))?no_esc}
        </div>
    <#elseif section = "form">
        <#if realm.password>
            <form id="kc-form-login" class="form ${properties.kcFormClass!}" action="${url.loginAction}" method="post">
                <div class="username-container ${properties.kcFormGroupClass!}">
                    <div class="${properties.kcLabelWrapperClass!}">
                        <label for="username"
                               class="${properties.kcLabelClass!}"><#if !realm.loginWithEmailAllowed>${msg("username")}<#elseif !realm.registrationEmailAsUsername>${msg("usernameOrEmail")}<#else>${msg("email")}</#if></label>
                    </div>
                    <div class="${properties.kcInputWrapperClass!} input-group">
                        <div class="input-group-addon"><i class="fa fa-user" aria-hidden="true"></i></div>
                        <#if usernameEditDisabled??>
                            <input id="username" class="form-control ${properties.kcInputClass!} " name="username" value="${(login.username!'')}" type="text"
                                   disabled/>
                        <#else>
                            <input id="username" class="form-control ${properties.kcInputClass!} " name="username" value="${(login.username!'')}" type="text"
                                   autofocus autocomplete="off"/>
                        </#if>
                    </div>
                </div>
                <div class="password-container ${properties.kcFormGroupClass!}">
                    <div class="${properties.kcLabelWrapperClass!}">
                        <label for="password" class="${properties.kcLabelClass!}">${msg("password")}</label>
                    </div>

                    <div class="${properties.kcInputWrapperClass!} input-group">
                        <div class="input-group-addon"><i class="fa fa-lock" aria-hidden="true"></i></div>
                        <input id="password" class="form-control ${properties.kcInputClass!}" name="password" type="password" autocomplete="off"/>
                    </div>
                </div>

                <div class="${properties.kcFormGroupClass!} ">
                     <#if verifyCodeImg??>
                    <div id="kc-form-options" class="${properties.kcFormOptionsClass!}">
						<div class="${properties.kcInputWrapperClass!} input-group">
							<input id="verifyCode" class="form-control ${properties.kcInputClass!}" name="verifyCode" type="text" autocomplete="off" style="width: 60%;margin-right: 5px;" />
							<img src="${verifyCodeImg}" />
						</div>
					</div>
                    </#if>
                    <div id="kc-form-options" class="${properties.kcFormOptionsClass!}">
                        <#if realm.rememberMe && !usernameEditDisabled??>
                            <div class="checkbox remember-me-checkbox">
                                <label>
                                    <#if login.rememberMe??>
                                        <input id="rememberMe" name="rememberMe" type="checkbox" tabindex="3" checked>&nbsp;&nbsp;${msg("rememberMe")}
                                    <#else>
                                        <input id="rememberMe" name="rememberMe" type="checkbox" tabindex="3">&nbsp;&nbsp;${msg("rememberMe")}
                                    </#if>
                                </label>
                            </div>
                        </#if>
                    </div>
                    <div id="kc-form-buttons" class=" ${properties.kcFormButtonsClass!}">
                        <div class="${properties.kcFormButtonsWrapperClass!}">
                            <input class="btn btn-primary btn-flat btn-block ${properties.kcButtonClass!} ${properties.kcButtonPrimaryClass!} ${properties.kcButtonLargeClass!}"
                                   name="login" id="kc-login" type="submit" value="${msg("doLogIn")}"/>
                            <div class="clearfix"></div>
                        </div>
                    </div>
                    <div>
                        <#if (realm.password && realm.registrationAllowed && !usernameEditDisabled??) || realm.resetPasswordAllowed>
                            <div>
                                <div class="col-xs-12">
                                    <hr style="border-top: 1px solid #eee;    margin-top: 5px; margin-bottom: 5px;"/>
                                    <div class="clearfix"></div>
                                </div>
                            </div>
                            <div>
                                <#if realm.password && realm.registrationAllowed && !usernameEditDisabled??>
                                    <div id="kc-registration" class="col-xs-6" style="padding: 0px;">
                                        <span>${msg("noAccount")} <a href="${url.registrationUrl}">${msg("doRegister")}</a></span>
                                        <div class="clearfix"></div>
                                    </div>
                                </#if>
                                <#if realm.resetPasswordAllowed>
                                    <div class="${properties.kcFormOptionsWrapperClass!} col-xs-6" style="text-align: end;padding: 0px" >
                                        <span><a href="${url.loginResetCredentialsUrl}">${msg("doForgotPassword")}</a></span>
                                        <div class="clearfix"></div>
                                    </div>
                                </#if>
                                <div class="clearfix"></div>
                            </div>
                        </#if>
                    </div>
                </div>
            </form>
        </#if>
    <#elseif section = "social" >
        <#if realm.password && social.providers??>
            <div>
                <div class="col-xs-12">
                    <hr style="border-top: 1px solid #eee;    margin-top: 5px; margin-bottom: 5px;"/>
                    <div class="clearfix"></div>
                </div>
            </div>
            <div id="kc-social-providers">
                <ul class="list-inline" style="margin-top: 5px">
                    <#list social.providers as p>
                        <li style="list-style-type:none"><i class="${properties.kcCommonLogoIdP!} ${p.iconClasses!}" aria-hidden="true"></i><a
                                    href="${p.loginUrl}" id="zocial-${p.alias}" class="zocial ${p.providerId}"> <span class="text">${p.displayName}</span></a>
                        </li>
                    </#list>
                </ul>
            </div>
        </#if>
    </#if>
</@layout.registrationLayout>
